package com.example.mall.domain;

import java.math.BigDecimal;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.example.mall.util.CodeGenerateUtils;
import lombok.Data;

import java.io.Serializable;

/**
 * <p>
 * 订单明细表
 * </p>
 *
 * @author whale
 * @since 2025-05-09
 */
@TableName("tb_order_details")
@Data
public class OrderDetails extends Model<OrderDetails> {

    private static final long serialVersionUID = 1L;

    /**
     * 订单明细唯一标识
     */
    @TableId("detail_id")
    private Long detailId;
    private String orderNo;
    /**
     * 订单ID
     */
    @TableField("order_id")
    private Long orderId;
    /**
     * 商品ID
     */
    @TableField("product_id")
    private Long productId;
    /**
     * 购买数量
     */
    private String quantity;
    /**
     * 商品单价
     */
    private BigDecimal price;
    /**
     * 创建时间
     */
    @TableField("create_date")
    private Date createDate;
    /**
     * 更新时间
     */
    @TableField("update_date")
    private Date updateDate;

    public OrderDetails() {
        this.detailId = Long.valueOf(CodeGenerateUtils.generateUniqueId());
    }

    public Long getDetailId() {
        return detailId;
    }

    public void setDetailId(Long detailId) {
        this.detailId = detailId;
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public String getQuantity() {
        return quantity;
    }

    public void setQuantity(String quantity) {
        this.quantity = quantity;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    @Override
    public String toString() {
        return "OrderDetails{" +
        ", detailId=" + detailId +
        ", orderId=" + orderId +
        ", productId=" + productId +
        ", quantity=" + quantity +
        ", price=" + price +
        ", createDate=" + createDate +
        ", updateDate=" + updateDate +
        "}";
    }
}
